import user from './index'

const reducer = (state = { ...user.state }, actions: { type: string, value: any }) => {

    const newState = JSON.parse(JSON.stringify(state))
    switch (actions.type) {
        case user.actionsName.setToken:
            user.actions.setToken(newState, actions)
            break;
        case user.actionsName.setUserInfo:
            user.actions.setUserInfo(newState, actions)
            break;
        case user.actionsName.setShopData:
            user.actions.setShopData(newState, actions)
            break;
        case user.actionsName.setShopsOptions:
            user.actions.setShopsOptions(newState, actions)
            break;
        default:
            break;
    }
    return newState

}
export default reducer